package com.shuyihui.databindinglib;

import android.os.Looper;

import androidx.lifecycle.MutableLiveData;

/**
 * 数据订阅
 * @param <T>
 */
public class BaseLiveData<T> extends MutableLiveData<T> {
    /**
     * 发送数据
     * @param value
     */
    public void update(T value) {
        if (Looper.myLooper() == Looper.getMainLooper()) {
            super.setValue(value);
        } else {
            postValue(value);
        }
    }
}
